package com.chuxuan.Math.Sort;

public class Sort{

    public Integer[] BubbleSort(Integer ar[]){
        BubbleSort bubbleSort=new BubbleSort(ar);
        return bubbleSort.getAr();
    }
    public Integer[] QuickSort(Integer ar[]){
        QuickSort quickSort=new QuickSort(ar);
        return quickSort.getAr();
    }
    public Integer[] HeapSort(Integer ar[]){
        HeapSort heapSort=new HeapSort(ar);
        return heapSort.getAr();
    }
    public Integer[] MergeSort(Integer ar[]){
        MergeSort mergeSort=new MergeSort(ar);
        return mergeSort.getAr();
    }
    public Integer[] RadixSort(Integer ar[]){
        RadixSort radixSort=new RadixSort(ar);
        return radixSort.getAr();
    }
    public Integer[] SelectSort(Integer ar[]){
        SelectSort selectSort=new SelectSort(ar);
        return selectSort.getAr();
    }
    public Integer[] ShellSort(Integer ar[]){
        ShellSort shellSort=new ShellSort(ar);
        return shellSort.getAr();
    }
    public Integer[] InsertSort(Integer ar[]){
        InsertSort insertSort=new InsertSort(ar);
        return insertSort.getAr();
    }
    public void TestTime(Long times,Integer ar[],TestInterface testInterface){
        long currentTime=System.currentTimeMillis();
        for (Long k = 0L; k< times; k++) {
        //这里我需要执行本类的方法，也可以自定义这段代码
            testInterface.execute(ar);
        }
        long nowTime=System.currentTimeMillis();
        System.out.println("cost time:"+(nowTime-currentTime));
    }
    interface TestInterface {
        void execute(Integer ar[]);
    }
//    public static void main( String[] args )
//    {
//        Sort sort=new Sort();
//        Integer[] x=new Integer[10];
//        x= new Integer[]{10,3, 2,  4, 550,  7,1,6,8,9,7,6,2,5,7,6,7};
//
//        sort.TestTime(1000000L-1, x, new BubbleSort(x));
//        sort.TestTime(1000000L-1, x, new MergeSort(x));
//        for (Integer a:x
//             ) {
//            System.out.println(a);
//        }
//
//    }
}
